package com.ct.service;

import cn.hutool.log.StaticLog;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
public class OrderAsyncService {

    @Async("taskExecutor")
    public void sendMessage(Long userId) {
        StaticLog.info("计算结果 4/2 结果为:{}", 4 / 2);
        StaticLog.info("计算结果 1/0 结果为:{}", 1 / 0);
        Integer a = 1 / 0;
        StaticLog.info("计算结果 1/0 结果为:{}", a);
        if (true) {
            StaticLog.error("error--这儿有运行时异常抛出");
            StaticLog.info("info--这儿有运行时异常抛出");
            throw new RuntimeException("运行时异常抛出");
        }
        StaticLog.info("发消息订单下单成功，用户是：{}", userId);
    }

    @Async("taskExecutor2")
    public void socreGet(Long userId) {
        StaticLog.info("赠送积分成功，用户是：{}", userId);
    }
}